home *** CD-ROM | disk | FTP | other *** search
- #!/usr/bin/perl5
- #
- # adv-config.frm
- #
- # Copyright 1988-1996 Silicon Graphics, Inc.
- # All rights reserved.
- #
- # This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, Inc.;
- # the contents of this file may not be disclosed to third parties, copied or
- # duplicated in any form, in whole or in part, without the prior written
- # permission of Silicon Graphics, Inc.
- #
- # RESTRICTED RIGHTS LEGEND:
- # Use, duplication or disclosure by the Government is subject to restrictions
- # as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data
- # and Computer Software clause at DFARS 252.227-7013, and/or in similar or
- # successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished -
- # rights reserved under the Copyright Laws of the United States.
- #
-
- BEGIN { require "/usr/WebFace/lib/CGI.pm"; import CGI; }
- require "/usr/OnRamp/lib/OnRamp.pm";
- require "/usr/OnRamp/lib/java.pm";
-
- $query = new CGI;
-
- $nsswitch_cf = "/etc/nsswitch.conf";
- $dummy = "/etc/nsswitch.conf.tmp";
- $title = "Unified Name Service";
- $help_page = "adv-config-help.html";
-
- if (! -e "/usr/etc/nsd")
- {
- print "Content-type: text/html\n\n"
- . "<html><head><title>$title</title>\n"
- . "<body><center><h1>$title</h1></center>\n"
- . "<i>The Unified Name Service (UNS) is available on "
- . "IRIX versions 6.5 and higher. For information "
- . "about upgrading to IRIX 6.5, please contact your "
- . "local Silicon Graphics sales representative.</i>\n"
- . "</body></html>\n";
- exit 0;
- }
-
- $done = $ARGV[0];
- $instructions = "<blockquote>
- Click on any of the following configuration buttons to modify
- the configuration for that map. When you are done configuring
- maps, use the \"Ok\" button to view your changes.
- </blockquote><p>\n";
-
-
- $continue = "return (true)";
- $input = $dummy;
- if ($done eq 'done') {
- $message = "Your changes have been made.";
- rename($dummy, $nsswitch_cf);
- system("/sbin/chkconfig", "yp", "on")
- if ($query->param('chkconfig') == 1);
- system("/etc/killall", "-HUP", "nsd");
- $continue = "return (false)";
- $input = $nsswitch_cf;
- }
- if (! $done || $done eq 'done') {
- # Set up temporary file
- open(NSSWITCH, $nsswitch_cf);
- open(TEMP, ">$dummy");
- while ($line = <NSSWITCH>) {
- print TEMP $line;
- }
- close(TEMP);
- close(NSSWITCH);
- $continue = "return (false)";
- }
-
- print $query->header;
- &generic;
-
- sub generic {
- local ($num_maps) = 0;
- local ($count) = &count_maps($input);
-
- &title_block($title);
- &header_block($title);
-
- print $query->startform("POST", "adv-parse.cgi?do_summary", "",
- "NAME=StandardForm");
-
- print "<i>$message</i><p>\n";
- print $instructions;
-
- print qq|<font size="+1"><center><table border=1>\n|;
-
- print "<tr valign=top><td><table>";
- open(NSSWITCH, $input);
- while ($line = <NSSWITCH>) {
- if ($line =~ /^\s*[#\n\(]/) {
- print TEMP "$line";
- next;
- }
- @entlist = split(/\s+/, $line);
- chop ($entlist[0]);
- $entlist[0] =~ s/(\S+)\s*(\(\S+\)*)$/\1/g;
- $map = $entlist[0];
- $cur_maps++;
- $rem = ($count % 2) + 1;
- print "</table></td><td><table>\n"
- if ($cur_maps == (int($count/2) + $rem));
- print qq|<tr><td>$map </td><td><input type=button value="Configure"
- onClick='location="adv-parse.cgi?$map"'>\n|;
- }
- close(NSSWITCH);
- print "</table>\n<tr><td colspan=2 align=center><br>\n";
- print qq|<input type=button value=" Add New Maps "
- onClick='location="adv-parse.cgi"'>|;
- print "<br><br></td></tr>\n</tr></table><p>\n";
-
- print qq|<input type="submit" name="doit" value=" Ok "
- onClick="$continue"></center></font>|;
-
- print $query->endform;
- }
-
- sub count_maps {
- local ($num_maps) = 0;
-
- open(NSSWITCH, $_[0]);
- while ($line = <NSSWITCH>) {
- next if ($line =~ /^\s*[#\n\(]/);
- $num_maps++;
- }
- close(NSSWITCH);
- $num_maps;
- }
-